import * as React from 'react';
import { Form, Input, Modal, Select, message, DatePicker } from 'antd';
import request from '@/http';

import moment from 'moment';
const { Option } = Select;

interface absenceDetailObject {
  isModalVisible: boolean;
  id?: number;
  courseTime?: any;
}

const ADetail = (props: { editObject: absenceDetailObject }) => {
  const { editObject } = props;
  console.log(editObject);
  const [isModalVisible, setIsModalVisible] = React.useState(false);
  const [formObject] = Form.useForm();

  const modelOnOk = async () => {
    setIsModalVisible(false);
  };

  const modelOnCancel = () => {
    setIsModalVisible(false);
  };

  React.useEffect(() => {
    setIsModalVisible(editObject.isModalVisible);
    if (editObject.id !== null) {
      formObject.setFieldsValue({
        courseTime: editObject.courseTime,
      });
    }
  }, [editObject]);

  return (
    <>
      <Modal
        width={1200}
        className="modal"
        title="请假原因"
        visible={isModalVisible}
        onCancel={modelOnCancel}
        onOk={modelOnOk}
        maskClosable={false}
        destroyOnClose
        okText="确认"
        cancelText="取消"
      >
        <Form
          className="form"
          name="editForm"
          form={formObject}
          preserve={false}
        >
          123123123
        </Form>
      </Modal>
    </>
  );
};

export { ADetail, absenceDetailObject };
